class Solution {
    public int[] getAverages(int[] nums, int k) {
        int[] ret = new int[nums.length];
        Arrays.fill(ret, -1);
        long sum = 0;
        for(int i = 0; i < nums.length; i++){
            sum += nums[i];
            if(i < k * 2) { continue;}
            ret[i - k] = (int) (sum / (k * 2 + 1));
            sum -= nums[i - k * 2];
        }
        return ret;
    }
}